home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / doom / map_edit.zip / MAP_EDIT / PROGS / CLIENT.QC < prev    next >
Text File  |  1996-10-02  |  33KB  |  1,470 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35.     if (self.health <= 0)
  36.     {
  37.         SetNewParms ();
  38.         return;
  39.     }
  40.  
  41. // remove items
  42.     self.items = self.items - (self.items & 
  43.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  44.     
  45. // cap super health
  46.     if (self.health > 100)
  47.         self.health = 100;
  48.     if (self.health < 50)
  49.         self.health = 50;
  50.     parm1 = self.items;
  51.     parm2 = self.health;
  52.     parm3 = self.armorvalue;
  53.     if (self.ammo_shells < 25)
  54.         parm4 = 25;
  55.     else
  56.         parm4 = self.ammo_shells;
  57.     parm5 = self.ammo_nails;
  58.     parm6 = self.ammo_rockets;
  59.     parm7 = self.ammo_cells;
  60.     parm8 = self.weapon;
  61.     parm9 = self.armortype * 100;
  62. };
  63.  
  64. void() SetNewParms =
  65. {
  66.     parm1 = IT_SHOTGUN | IT_AXE;
  67.     parm2 = 100;
  68.     parm3 = 0;
  69.     parm4 = 25;
  70.     parm5 = 0;
  71.     parm6 = 0;
  72.     parm7 = 0;
  73.     parm8 = 1;
  74.     parm9 = 0;
  75. };
  76.  
  77. void() DecodeLevelParms =
  78. {
  79.     if (serverflags)
  80.     {
  81.         if (world.model == "maps/start.bsp")
  82.             SetNewParms ();        // take away all stuff on starting new episode
  83.     }
  84.     
  85.     self.items = parm1;
  86.     self.health = parm2;
  87.     self.armorvalue = parm3;
  88.     self.ammo_shells = parm4;
  89.     self.ammo_nails = parm5;
  90.     self.ammo_rockets = parm6;
  91.     self.ammo_cells = parm7;
  92.     self.weapon = parm8;
  93.     self.armortype = parm9 * 0.01;
  94. };
  95.  
  96. /*
  97. ============
  98. FindIntermission
  99.  
  100. Returns the entity to view from
  101. ============
  102. */
  103. entity() FindIntermission =
  104. {
  105.     local    entity spot;
  106.     local    float cyc;
  107.  
  108. // look for info_intermission first
  109.     spot = find (world, classname, "info_intermission");
  110.     if (spot)
  111.     {    // pick a random one
  112.         cyc = random() * 4;
  113.         while (cyc > 1)
  114.         {
  115.             spot = find (spot, classname, "info_intermission");
  116.             if (!spot)
  117.                 spot = find (spot, classname, "info_intermission");
  118.             cyc = cyc - 1;
  119.         }
  120.         return spot;
  121.     }
  122.  
  123. // then look for the start position
  124.     spot = find (world, classname, "info_player_start");
  125.     if (spot)
  126.         return spot;
  127.     
  128. // testinfo_player_start is only found in regioned levels
  129.     spot = find (world, classname, "testplayerstart");
  130.     if (spot)
  131.         return spot;
  132.     
  133.     objerror ("FindIntermission: no spot");
  134. };
  135.  
  136.  
  137. string nextmap;
  138. void() GotoNextMap =
  139. {
  140.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  141.         changelevel (mapname);
  142.     else
  143.         changelevel (nextmap);
  144. };
  145.  
  146.  
  147. void() ExitIntermission =
  148. {
  149. // skip any text in deathmatch
  150.     if (deathmatch)
  151.     {
  152.         GotoNextMap ();
  153.         return;
  154.     }
  155.     
  156.     intermission_exittime = time + 1;
  157.     intermission_running = intermission_running + 1;
  158.  
  159. //
  160. // run some text if at the end of an episode
  161. //
  162.     if (intermission_running == 2)
  163.     {
  164.         if (world.model == "maps/e1m7.bsp")
  165.         {
  166.             WriteByte (MSG_ALL, SVC_CDTRACK);
  167.             WriteByte (MSG_ALL, 2);
  168.             WriteByte (MSG_ALL, 3);
  169.             if (!cvar("registered"))
  170.             {
  171.                 WriteByte (MSG_ALL, SVC_FINALE);
  172.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  173.             }
  174.             else
  175.             {
  176.                 WriteByte (MSG_ALL, SVC_FINALE);
  177.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  178.             }
  179.             return;
  180.         }
  181.         else if (world.model == "maps/e2m6.bsp")
  182.         {
  183.             WriteByte (MSG_ALL, SVC_CDTRACK);
  184.             WriteByte (MSG_ALL, 2);
  185.             WriteByte (MSG_ALL, 3);
  186.  
  187.             WriteByte (MSG_ALL, SVC_FINALE);
  188.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  189.             return;
  190.         }
  191.         else if (world.model == "maps/e3m6.bsp")
  192.         {
  193.             WriteByte (MSG_ALL, SVC_CDTRACK);
  194.             WriteByte (MSG_ALL, 2);
  195.             WriteByte (MSG_ALL, 3);
  196.  
  197.             WriteByte (MSG_ALL, SVC_FINALE);
  198.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  199.             return;
  200.         }
  201.         else if (world.model == "maps/e4m7.bsp")
  202.         {
  203.             WriteByte (MSG_ALL, SVC_CDTRACK);
  204.             WriteByte (MSG_ALL, 2);
  205.             WriteByte (MSG_ALL, 3);
  206.  
  207.             WriteByte (MSG_ALL, SVC_FINALE);
  208.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  209.             return;
  210.         }
  211.  
  212.         GotoNextMap();
  213.     }
  214.     
  215.     if (intermission_running == 3)
  216.     {
  217.         if (!cvar("registered"))
  218.         {    // shareware episode has been completed, go to sell screen
  219.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  220.             return;
  221.         }
  222.         
  223.         if ( (serverflags&15) == 15)
  224.         {
  225.             WriteByte (MSG_ALL, SVC_FINALE);
  226.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  227.             return;
  228.         }
  229.         
  230.     }
  231.  
  232.     GotoNextMap();
  233. };
  234.  
  235. /*
  236. ============
  237. IntermissionThink
  238.  
  239. When the player presses attack or jump, change to the next level
  240. ============
  241. */
  242. void() IntermissionThink =
  243. {
  244.     if (time < intermission_exittime)
  245.         return;
  246.  
  247.     if (!self.button0 && !self.button1 && !self.button2)
  248.         return;
  249.     
  250.     ExitIntermission ();
  251. };
  252.  
  253. void() execute_changelevel =
  254. {
  255.     local entity    pos;
  256.  
  257.     intermission_running = 1;
  258.     
  259. // enforce a wait time before allowing changelevel
  260.     if (deathmatch)
  261.         intermission_exittime = time + 5;
  262.     else
  263.         intermission_exittime = time + 2;
  264.  
  265.     WriteByte (MSG_ALL, SVC_CDTRACK);
  266.     WriteByte (MSG_ALL, 3);
  267.     WriteByte (MSG_ALL, 3);
  268.     
  269.     pos = FindIntermission ();
  270.  
  271.     other = find (world, classname, "player");
  272.     while (other != world)
  273.     {
  274.         other.view_ofs = '0 0 0';
  275.         other.angles = other.v_angle = pos.mangle;
  276.         other.fixangle = TRUE;        // turn this way immediately
  277.         other.nextthink = time + 0.5;
  278.         other.takedamage = DAMAGE_NO;
  279.         other.solid = SOLID_NOT;
  280.         other.movetype = MOVETYPE_NONE;
  281.         other.modelindex = 0;
  282.         setorigin (other, pos.origin);
  283.         other = find (other, classname, "player");
  284.     }    
  285.  
  286.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  287. };
  288.  
  289.  
  290. void() changelevel_touch =
  291. {
  292.     local entity    pos;
  293.  
  294.     if (other.classname != "player")
  295.         return;
  296.  
  297.     if (cvar("noexit"))
  298.     {
  299.         T_Damage (other, self, self, 50000);
  300.         return;
  301.     }
  302.     bprint (other.netname);
  303.     bprint (" exited the level\n");
  304.     
  305.     nextmap = self.map;
  306.  
  307.     SUB_UseTargets ();
  308.  
  309.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  310.     {    // NO_INTERMISSION
  311.         GotoNextMap();
  312.         return;
  313.     }
  314.     
  315.     self.touch = SUB_Null;
  316.  
  317. // we can't move people right now, because touch functions are called
  318. // in the middle of C movement code, so set a think time to do it
  319.     self.think = execute_changelevel;
  320.     self.nextthink = time + 0.1;
  321. };
  322.  
  323. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  324. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  325. */
  326. void() trigger_changelevel =
  327. {
  328.     if (!self.map)
  329.         objerror ("chagnelevel trigger doesn't have map");
  330.     
  331.     InitTrigger ();
  332.     self.touch = changelevel_touch;
  333. };
  334.  
  335.  
  336. /*
  337. =============================================================================
  338.  
  339.                 PLAYER GAME EDGE FUNCTIONS
  340.  
  341. =============================================================================
  342. */
  343.  
  344. void() set_suicide_frame;
  345.  
  346. // called by ClientKill and DeadThink
  347. void() respawn =
  348. {
  349.     if (coop)
  350.     {
  351.         // make a copy of the dead body for appearances sake
  352.         CopyToBodyQue (self);
  353.         // get the spawn parms as they were at level start
  354.         setspawnparms (self);
  355.         // respawn        
  356.         PutClientInServer ();
  357.     }
  358.     else if (deathmatch)
  359.     {
  360.         // make a copy of the dead body for appearances sake
  361.         CopyToBodyQue (self);
  362.         // set default spawn parms
  363.         SetNewParms ();
  364.         // respawn        
  365.         PutClientInServer ();
  366.     }
  367.     else
  368.     {    // restart the entire server
  369.         localcmd ("restart\n");
  370.     }
  371. };
  372.  
  373.  
  374. /*
  375. ============
  376. ClientKill
  377.  
  378. Player entered the suicide command
  379. ============
  380. */
  381. void() ClientKill =
  382. {
  383.     bprint (self.netname);
  384.     bprint (" suicides\n");
  385.     set_suicide_frame ();
  386.     self.modelindex = modelindex_player;
  387.     self.frags = self.frags - 2;    // extra penalty
  388.     respawn ();
  389. };
  390.  
  391. float(vector v) CheckSpawnPoint =
  392. {
  393.     return FALSE;
  394. };
  395.  
  396. /*
  397. ============
  398. SelectSpawnPoint
  399.  
  400. Returns the entity to spawn at
  401. ============
  402. */
  403. entity() SelectSpawnPoint =
  404. {
  405.     local    entity spot;
  406.     
  407. // testinfo_player_start is only found in regioned levels
  408.     spot = find (world, classname, "testplayerstart");
  409.     if (spot)
  410.         return spot;
  411.         
  412. // choose a info_player_deathmatch point
  413.     if (coop)
  414.     {
  415.         lastspawn = find(lastspawn, classname, "info_player_coop");
  416.         if (lastspawn == world)
  417.             lastspawn = find (lastspawn, classname, "info_player_start");
  418.         if (lastspawn != world)
  419.             return lastspawn;
  420.     }
  421.     else if (deathmatch)
  422.     {
  423.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  424.         if (lastspawn == world)
  425.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  426.         if (lastspawn != world)
  427.             return lastspawn;
  428.     }
  429.  
  430.     if (serverflags)
  431.     {    // return with a rune to start
  432.         spot = find (world, classname, "info_player_start2");
  433.         if (spot)
  434.             return spot;
  435.     }
  436.     
  437.     spot = find (world, classname, "info_player_start");
  438.     if (!spot)
  439.         error ("PutClientInServer: no info_player_start on level");
  440.     
  441.     return spot;
  442. };
  443.  
  444. // OBSERVER
  445.  
  446. void() Observer =
  447. {
  448. //*********************************************************     
  449.     // BEGIN OBSERVER FUNCTION
  450. //**********************************************************
  451.  
  452. // Change player to empty model
  453.      self.model = string_null;
  454. //     setsize (self, '-16 -16 -24','16 16 40');
  455.      setsize (self, '0 0 0','0 0 0');
  456.      self.frame = 1;
  457.      w_observer_num = w_observer_num + 1;   // NUMBER OF OBSERVERS
  458.          
  459. // GOD MODE
  460.      self.weapon = 0;
  461.          self.weaponmodel = "";
  462.      self.frags = 0;        // REMOVE FRAGS
  463.      self.solid = SOLID_NOT;
  464.  
  465.      self.takedamage = DAMAGE_NO;
  466.      self.air_finished = time + 1000000;
  467.      self.th_pain = SUB_Null;
  468.      self.th_die = SUB_Null;
  469.          self.touch = SUB_Null;
  470.  
  471.      centerprint(self,"JAFO MODE"); 
  472.      bprint("\n");
  473.      bprint(self.netname); 
  474.      bprint(" ");
  475.      bprint("HAS ENTERED JAFO MODE");   
  476.      bprint("\n");
  477.         // (J)ust (A)nother (F)ucking (O)bserver!
  478.  
  479. // Don't allow player to return to normal until next level game
  480.  
  481. };              // END OBSERVER FUNCTION
  482.  
  483.  
  484.  
  485. /*
  486. ===========
  487. PutClientInServer
  488.  
  489. called each time a player is spawned
  490. ============
  491. */
  492. void() DecodeLevelParms;
  493. void() PlayerDie;
  494.  
  495.  
  496. void() PutClientInServer =
  497. {
  498.     local    entity spot;
  499.  
  500.     self.classname = "player";
  501.     self.health = 100;
  502.     self.takedamage = DAMAGE_AIM;
  503.     self.solid = SOLID_SLIDEBOX;
  504.     self.movetype = MOVETYPE_WALK;
  505.     self.show_hostile = 0;
  506.     self.max_health = 100;
  507.     self.flags = FL_CLIENT;
  508.     self.air_finished = time + 12;
  509.     self.dmg = 2;           // initial water damage
  510.     self.super_damage_finished = 0;
  511.     self.radsuit_finished = 0;
  512.     self.invisible_finished = 0;
  513.     self.invincible_finished = 0;
  514.     self.effects = 0;
  515.     self.invincible_time = 0;
  516.  
  517.     DecodeLevelParms ();
  518.     
  519.     W_SetCurrentAmmo ();
  520.  
  521.     self.attack_finished = time;
  522.     self.th_pain = player_pain;
  523.     self.th_die = PlayerDie;
  524.     
  525.     self.deadflag = DEAD_NO;
  526. // paustime is set by teleporters to keep the player from moving a while
  527. // MAP_EDIT
  528.  
  529.       if (semipaused)
  530.      self.pausetime = time + 10000;
  531.       else
  532.      self.pausetime = 0;
  533.  
  534.     spot = SelectSpawnPoint ();
  535.  
  536.     self.origin = spot.origin + '0 0 1';
  537.     self.angles = spot.angles;
  538.     self.fixangle = TRUE;        // turn this way immediately
  539.  
  540. // oh, this is a hack!
  541.     setmodel (self, "progs/eyes.mdl");
  542.     modelindex_eyes = self.modelindex;
  543.  
  544.     setmodel (self, "progs/player.mdl");
  545.     modelindex_player = self.modelindex;
  546.  
  547.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  548.     
  549.     self.view_ofs = '0 0 22';
  550.  
  551.     player_stand1 ();
  552.     
  553.     if (deathmatch || coop)
  554.     {
  555.         makevectors(self.angles);
  556.         spawn_tfog (self.origin + v_forward*20);
  557.     }
  558.  
  559.     spawn_tdeath (self.origin, self);
  560. };
  561.  
  562.  
  563. /*
  564. =============================================================================
  565.  
  566.                 QUAKED FUNCTIONS
  567.  
  568. =============================================================================
  569. */
  570.  
  571.  
  572. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  573. The normal starting point for a level.
  574. */
  575. void() info_player_start =
  576. {
  577. };
  578.  
  579.  
  580. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  581. Only used on start map for the return point from an episode.
  582. */
  583. void() info_player_start2 =
  584. {
  585. };
  586.  
  587.  
  588. /*
  589. saved out by quaked in region mode
  590. */
  591. void() testplayerstart =
  592. {
  593. };
  594.  
  595. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  596. potential spawning position for deathmatch games
  597. */
  598. void() info_player_deathmatch =
  599. {
  600. };
  601.  
  602. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  603. potential spawning position for coop games
  604. */
  605. void() info_player_coop =
  606. {
  607. };
  608.  
  609. /*
  610. ===============================================================================
  611.  
  612. RULES
  613.  
  614. ===============================================================================
  615. */
  616.  
  617. /*
  618. go to the next level for deathmatch
  619. only called if a time or frag limit has expired
  620. */
  621. void() NextLevel =
  622. {
  623.     local entity o;
  624.  
  625.     if (mapname == "start")
  626.     {
  627.         if (!cvar("registered"))
  628.         {
  629.             mapname = "e1m1";
  630.         }
  631.         else if (!(serverflags & 1))
  632.         {
  633.             mapname = "e1m1";
  634.             serverflags = serverflags + 1;
  635.         }
  636.         else if (!(serverflags & 2))
  637.         {
  638.             mapname = "e2m1";
  639.             serverflags = serverflags + 2;
  640.         }
  641.         else if (!(serverflags & 4))
  642.         {
  643.             mapname = "e3m1";
  644.             serverflags = serverflags + 4;
  645.         }
  646.         else if (!(serverflags & 8))
  647.         {
  648.             mapname = "e4m1";
  649.             serverflags = serverflags + 8;
  650.         }
  651.         else
  652.         {
  653.             mapname = "start";
  654.             serverflags = serverflags - 15;
  655.         }
  656.  
  657.         o = spawn();
  658.         o.map = mapname;
  659.     }
  660.     else
  661.     {
  662.         // find a trigger changelevel
  663.         o = find(world, classname, "trigger_changelevel");
  664.  
  665.         // go back to start if no trigger_changelevel
  666.         if (!o)
  667.         {
  668.             mapname = "start";
  669.             o = spawn();
  670.             o.map = mapname;
  671.         }
  672.     }
  673.  
  674.     nextmap = o.map;
  675.     gameover = TRUE;
  676.     
  677.     if (o.nextthink < time)
  678.     {
  679.         o.think = execute_changelevel;
  680.         o.nextthink = time + 0.1;
  681.     }
  682. };
  683.  
  684. /*
  685. ============
  686. CheckRules
  687.  
  688. Exit deathmatch games upon conditions
  689. ============
  690. */
  691. void() CheckRules =
  692. {
  693.     local    float        timelimit;
  694.     local    float        fraglimit;
  695.     
  696.     if (gameover)    // someone else quit the game already
  697.         return;
  698.         
  699.     timelimit = cvar("timelimit") * 60;
  700.     fraglimit = cvar("fraglimit");
  701.     
  702.     if (timelimit && time >= timelimit)
  703.     {
  704.         NextLevel ();
  705.         return;
  706.     }
  707.     
  708.     if (fraglimit && self.frags >= fraglimit)
  709.     {
  710.         NextLevel ();
  711.         return;
  712.     }    
  713. };
  714.  
  715. //============================================================================
  716.  
  717. void() PlayerDeathThink =
  718. {
  719.     local entity    old_self;
  720.     local float        forward;
  721.  
  722.     if ((self.flags & FL_ONGROUND))
  723.     {
  724.         forward = vlen (self.velocity);
  725.         forward = forward - 20;
  726.         if (forward <= 0)
  727.             self.velocity = '0 0 0';
  728.         else    
  729.             self.velocity = forward * normalize(self.velocity);
  730.     }
  731.  
  732. // wait for all buttons released
  733.     if (self.deadflag == DEAD_DEAD)
  734.     {
  735.         if (self.button2 || self.button1 || self.button0)
  736.             return;
  737.         self.deadflag = DEAD_RESPAWNABLE;
  738.         return;
  739.     }
  740.  
  741. // wait for any button down
  742.     if (!self.button2 && !self.button1 && !self.button0)
  743.         return;
  744.  
  745.     self.button0 = 0;
  746.     self.button1 = 0;
  747.     self.button2 = 0;
  748.     respawn();
  749. };
  750.  
  751.  
  752. void() PlayerJump =
  753. {
  754.     local vector start, end;
  755.     
  756.     if (self.flags & FL_WATERJUMP)
  757.         return;
  758.     
  759.     if (self.waterlevel >= 2)
  760.     {
  761.         if (self.watertype == CONTENT_WATER)
  762.             self.velocity_z = 100;
  763.         else if (self.watertype == CONTENT_SLIME)
  764.             self.velocity_z = 80;
  765.         else
  766.             self.velocity_z = 50;
  767.  
  768. // play swiming sound
  769.         if (self.swim_flag < time)
  770.         {
  771.             self.swim_flag = time + 1;
  772.             if (random() < 0.5)
  773.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  774.             else
  775.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  776.         }
  777.  
  778.         return;
  779.     }
  780.  
  781.     if (!(self.flags & FL_ONGROUND))
  782.         return;
  783.  
  784.     if ( !(self.flags & FL_JUMPRELEASED) )
  785.         return;        // don't pogo stick
  786.  
  787.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  788.  
  789.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  790.     
  791.     self.button2 = 0;
  792. // player jumping sound
  793.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  794.     self.velocity_z = self.velocity_z + 270;
  795. };
  796.  
  797.  
  798. /*
  799. ===========
  800. WaterMove
  801.  
  802. ============
  803. */
  804. .float    dmgtime;
  805.  
  806. void() WaterMove =
  807. {
  808. //dprint (ftos(self.waterlevel));
  809.     if (self.movetype == MOVETYPE_NOCLIP)
  810.         return;
  811.     if (self.health < 0)
  812.         return;
  813.  
  814.     if (self.waterlevel != 3)
  815.     {
  816.         if (self.air_finished < time)
  817.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  818.         else if (self.air_finished < time + 9)
  819.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  820.         self.air_finished = time + 12;
  821.         self.dmg = 2;
  822.     }
  823.     else if (self.air_finished < time)
  824.     {    // drown!
  825.         if (self.pain_finished < time)
  826.         {
  827.             self.dmg = self.dmg + 2;
  828.             if (self.dmg > 15)
  829.                 self.dmg = 10;
  830.             T_Damage (self, world, world, self.dmg);
  831.             self.pain_finished = time + 1;
  832.         }
  833.     }
  834.     
  835.     if (!self.waterlevel)
  836.     {
  837.         if (self.flags & FL_INWATER)
  838.         {    
  839.             // play leave water sound
  840.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  841.             self.flags = self.flags - FL_INWATER;
  842.         }
  843.         return;
  844.     }
  845.  
  846.     if (self.watertype == CONTENT_LAVA)
  847.     {    // do damage
  848.         if (self.dmgtime < time)
  849.         {
  850.             if (self.radsuit_finished > time)
  851.                 self.dmgtime = time + 1;
  852.             else
  853.                 self.dmgtime = time + 0.2;
  854.  
  855.             T_Damage (self, world, world, 10*self.waterlevel);
  856.         }
  857.     }
  858.     else if (self.watertype == CONTENT_SLIME)
  859.     {    // do damage
  860.         if (self.dmgtime < time && self.radsuit_finished < time)
  861.         {
  862.             self.dmgtime = time + 1;
  863.             T_Damage (self, world, world, 4*self.waterlevel);
  864.         }
  865.     }
  866.     
  867.     if ( !(self.flags & FL_INWATER) )
  868.     {    
  869.  
  870. // player enter water sound
  871.  
  872.         if (self.watertype == CONTENT_LAVA)
  873.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  874.         if (self.watertype == CONTENT_WATER)
  875.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  876.         if (self.watertype == CONTENT_SLIME)
  877.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  878.  
  879.         self.flags = self.flags + FL_INWATER;
  880.         self.dmgtime = 0;
  881.     }
  882.     
  883.     if (! (self.flags & FL_WATERJUMP) )
  884.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  885. };
  886.  
  887. void() CheckWaterJump =
  888. {
  889.     local vector start, end;
  890.  
  891. // check for a jump-out-of-water
  892.     makevectors (self.angles);
  893.     start = self.origin;
  894.     start_z = start_z + 8; 
  895.     v_forward_z = 0;
  896.     normalize(v_forward);
  897.     end = start + v_forward*24;
  898.     traceline (start, end, TRUE, self);
  899.     if (trace_fraction < 1)
  900.     {    // solid at waist
  901.         start_z = start_z + self.maxs_z - 8;
  902.         end = start + v_forward*24;
  903.         self.movedir = trace_plane_normal * -50;
  904.         traceline (start, end, TRUE, self);
  905.         if (trace_fraction == 1)
  906.         {    // open at eye level
  907.             self.flags = self.flags | FL_WATERJUMP;
  908.             self.velocity_z = 225;
  909.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  910.             self.teleport_time = time + 2;    // safety net
  911.             return;
  912.         }
  913.     }
  914. };
  915.  
  916.  
  917. /*
  918. ================
  919. PlayerPreThink
  920.  
  921. Called every frame before physics are run
  922. ================
  923. */
  924. void() PlayerPreThink =
  925. {
  926.     local    float    mspeed, aspeed;
  927.     local    float    r;
  928.  
  929.     if (intermission_running)
  930.     {
  931.         IntermissionThink ();    // otherwise a button could be missed between
  932.         return;                    // the think tics
  933.     }
  934.  
  935.     if (self.view_ofs == '0 0 0')
  936.         return;        // intermission or finale
  937.  
  938.     makevectors (self.v_angle);        // is this still used
  939.  
  940.     CheckRules ();
  941.     WaterMove ();
  942.  
  943.     if (self.waterlevel == 2)
  944.         CheckWaterJump ();
  945.  
  946.     if (self.deadflag >= DEAD_DEAD)
  947.     {
  948.         PlayerDeathThink ();
  949.         return;
  950.     }
  951.     
  952.     if (self.deadflag == DEAD_DYING)
  953.         return;    // dying, so do nothing
  954.  
  955.     if (self.button2)
  956.     {
  957.         PlayerJump ();
  958.     }
  959.     else
  960.         self.flags = self.flags | FL_JUMPRELEASED;
  961.  
  962. // teleporters can force a non-moving pause time    
  963.     if (time < self.pausetime)
  964.         self.velocity = '0 0 0';
  965. };
  966.     
  967. /*
  968. ================
  969. CheckPowerups
  970.  
  971. Check for turning off powerups
  972. ================
  973. */
  974. void() CheckPowerups =
  975. {
  976.     if (self.health <= 0)
  977.         return;
  978.  
  979. // invisibility
  980.     if (self.invisible_finished)
  981.     {
  982. // sound and screen flash when items starts to run out
  983.         if (self.invisible_sound < time)
  984.         {
  985.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  986.             self.invisible_sound = time + ((random() * 3) + 1);
  987.         }
  988.  
  989.  
  990.         if (self.invisible_finished < time + 3)
  991.         {
  992.             if (self.invisible_time == 1)
  993.             {
  994.                 sprint (self, "Ring of Shadows magic is fading\n");
  995.                 stuffcmd (self, "bf\n");
  996.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  997.                 self.invisible_time = time + 1;
  998.             }
  999.             
  1000.             if (self.invisible_time < time)
  1001.             {
  1002.                 self.invisible_time = time + 1;
  1003.                 stuffcmd (self, "bf\n");
  1004.             }
  1005.         }
  1006.  
  1007.         if (self.invisible_finished < time)
  1008.         {    // just stopped
  1009.             self.items = self.items - IT_INVISIBILITY;
  1010.             self.invisible_finished = 0;
  1011.             self.invisible_time = 0;
  1012.         }
  1013.         
  1014.     // use the eyes
  1015.         self.frame = 0;
  1016.         self.modelindex = modelindex_eyes;
  1017.     }
  1018.     else
  1019.         self.modelindex = modelindex_player;    // don't use eyes
  1020.  
  1021. // invincibility
  1022.     if (self.invincible_finished)
  1023.     {
  1024. // sound and screen flash when items starts to run out
  1025.         if (self.invincible_finished < time + 3)
  1026.         {
  1027.             if (self.invincible_time == 1)
  1028.             {
  1029.                 sprint (self, "Protection is almost burned out\n");
  1030.                 stuffcmd (self, "bf\n");
  1031.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1032.                 self.invincible_time = time + 1;
  1033.             }
  1034.             
  1035.             if (self.invincible_time < time)
  1036.             {
  1037.                 self.invincible_time = time + 1;
  1038.                 stuffcmd (self, "bf\n");
  1039.             }
  1040.         }
  1041.         
  1042.         if (self.invincible_finished < time)
  1043.         {    // just stopped
  1044.             self.items = self.items - IT_INVULNERABILITY;
  1045.             self.invincible_time = 0;
  1046.             self.invincible_finished = 0;
  1047.         }
  1048.         if (self.invincible_finished > time)
  1049.             self.effects = self.effects | EF_DIMLIGHT;
  1050.         else
  1051.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1052.     }
  1053.  
  1054. // super damage
  1055.     if (self.super_damage_finished)
  1056.     {
  1057.  
  1058. // sound and screen flash when items starts to run out
  1059.  
  1060.         if (self.super_damage_finished < time + 3)
  1061.         {
  1062.             if (self.super_time == 1)
  1063.             {
  1064.                 sprint (self, "Quad Damage is wearing off\n");
  1065.                 stuffcmd (self, "bf\n");
  1066.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1067.                 self.super_time = time + 1;
  1068.             }      
  1069.             
  1070.             if (self.super_time < time)
  1071.             {
  1072.                 self.super_time = time + 1;
  1073.                 stuffcmd (self, "bf\n");
  1074.             }
  1075.         }
  1076.  
  1077.         if (self.super_damage_finished < time)
  1078.         {    // just stopped
  1079.             self.items = self.items - IT_QUAD;
  1080.             self.super_damage_finished = 0;
  1081.             self.super_time = 0;
  1082.         }
  1083.         if (self.super_damage_finished > time)
  1084.             self.effects = self.effects | EF_DIMLIGHT;
  1085.         else
  1086.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1087.     }    
  1088.  
  1089. // suit    
  1090.     if (self.radsuit_finished)
  1091.     {
  1092.         self.air_finished = time + 12;        // don't drown
  1093.  
  1094. // sound and screen flash when items starts to run out
  1095.         if (self.radsuit_finished < time + 3)
  1096.         {
  1097.             if (self.rad_time == 1)
  1098.             {
  1099.                 sprint (self, "Air supply in Biosuit expiring\n");
  1100.                 stuffcmd (self, "bf\n");
  1101.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1102.                 self.rad_time = time + 1;
  1103.             }
  1104.             
  1105.             if (self.rad_time < time)
  1106.             {
  1107.                 self.rad_time = time + 1;
  1108.                 stuffcmd (self, "bf\n");
  1109.             }
  1110.         }
  1111.  
  1112.         if (self.radsuit_finished < time)
  1113.         {    // just stopped
  1114.             self.items = self.items - IT_SUIT;
  1115.             self.rad_time = 0;
  1116.             self.radsuit_finished = 0;
  1117.         }
  1118.     }    
  1119.  
  1120. };
  1121.  
  1122.  
  1123. /*
  1124. ================
  1125. PlayerPostThink
  1126.  
  1127. Called every frame after physics are run
  1128. ================
  1129. */
  1130. void() PlayerPostThink =
  1131. {
  1132.     local    float    mspeed, aspeed;
  1133.     local    float    r;
  1134.  
  1135.     if (self.view_ofs == '0 0 0')
  1136.         return;        // intermission or finale
  1137.     if (self.deadflag)
  1138.         return;
  1139.         
  1140. // do weapon stuff
  1141.  
  1142.     W_WeaponFrame ();
  1143.  
  1144. // check to see if player landed and play landing sound    
  1145.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1146.     {
  1147.         if (self.watertype == CONTENT_WATER)
  1148.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1149.         else if (self.jump_flag < -650)
  1150.         {
  1151.             T_Damage (self, world, world, 5); 
  1152.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1153.             self.deathtype = "falling";
  1154.         }
  1155.         else
  1156.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1157.  
  1158.         self.jump_flag = 0;
  1159.     }
  1160.  
  1161.     if (!(self.flags & FL_ONGROUND))
  1162.         self.jump_flag = self.velocity_z;
  1163.  
  1164.     CheckPowerups ();
  1165. };
  1166.  
  1167.  
  1168. /*
  1169. ===========
  1170. ClientConnect
  1171.  
  1172. called when a player connects to a server
  1173. ============
  1174. */
  1175. void() ClientConnect =
  1176. {
  1177.     bprint (self.netname);
  1178.     bprint (" entered the game\n");
  1179. // MAP_EDIT
  1180.       num_players = num_players + 1;
  1181.       if (semipaused)
  1182.        self.pausetime = time + 1000; 
  1183.       self.impulse = 215;
  1184.     
  1185. // a client connecting during an intermission can cause problems
  1186.     if (intermission_running)
  1187.         ExitIntermission ();
  1188. };
  1189.  
  1190.  
  1191. /*
  1192. ===========
  1193. ClientDisconnect
  1194.  
  1195. called when a player disconnects from a server
  1196. ============
  1197. */
  1198. void() ClientDisconnect =
  1199. {
  1200.     if (gameover)
  1201.         return;
  1202.     // if the level end trigger has been activated, just return
  1203.     // since they aren't *really* leaving
  1204. // MAP_EDIT
  1205.         if ((admins == 1) && (self.netname == "Admin"))
  1206.          Admin(212);
  1207.         if (self.flags >= FL_OBSERVER)
  1208.          w_observer_num = w_observer_num - 1; 
  1209.  
  1210.     // let everyone else know
  1211.     bprint (self.netname);
  1212.     bprint (" left the game with ");
  1213.     bprint (ftos(self.frags));
  1214.     bprint (" frags\n");
  1215.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1216.     set_suicide_frame ();
  1217. };
  1218.  
  1219. /*
  1220. ===========
  1221. ClientObituary
  1222.  
  1223. called when a player dies
  1224. ============
  1225. */
  1226. void(entity targ, entity attacker) ClientObituary =
  1227. {
  1228.     local    float rnum;
  1229.     local    string deathstring, deathstring2;
  1230.     rnum = random();
  1231.  
  1232.     if (targ.classname == "player")
  1233.     {
  1234.         if (attacker.classname == "teledeath")
  1235.         {
  1236.             bprint (targ.netname);
  1237.             bprint (" was telefragged by ");
  1238.             bprint (attacker.owner.netname);
  1239.             bprint ("\n");
  1240.  
  1241.             attacker.owner.frags = attacker.owner.frags + 1;
  1242.             return;
  1243.         }
  1244.  
  1245.         if (attacker.classname == "teledeath2")
  1246.         {
  1247.             bprint ("Satan's power deflects ");
  1248.             bprint (targ.netname);
  1249.             bprint ("'s telefrag\n");
  1250.  
  1251.             targ.frags = targ.frags - 1;
  1252.             return;
  1253.         }
  1254.  
  1255.         if (attacker.classname == "player")
  1256.         {
  1257.             if (targ == attacker)
  1258.             {
  1259.                 // killed self
  1260.                 attacker.frags = attacker.frags - 1;
  1261.                 bprint (targ.netname);
  1262.                 
  1263.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1264.                 {
  1265.                     bprint (" discharges into the water.\n");
  1266.                     return;
  1267.                 }
  1268.                 if (targ.weapon == IT_GRENADE_LAUNCHER)
  1269.                     bprint (" tries to put the pin back in\n");
  1270.                 else
  1271.                     bprint (" becomes bored with life\n");
  1272.                 return;
  1273.             }
  1274.             else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
  1275.             {
  1276.                 if (rnum < 0.25)
  1277.                     deathstring = " mows down a teammate\n";
  1278.                 else if (rnum < 0.50)
  1279.                     deathstring = " checks his glasses\n";
  1280.                 else if (rnum < 0.75)
  1281.                     deathstring = " gets a frag for the other team\n";
  1282.                 else
  1283.                     deathstring = " loses another friend\n";
  1284.                 bprint (attacker.netname);
  1285.                 bprint (deathstring);
  1286.                 attacker.frags = attacker.frags - 1;
  1287.                 return;
  1288.             }
  1289.             else
  1290.             {
  1291.                 attacker.frags = attacker.frags + 1;
  1292.  
  1293.                 rnum = attacker.weapon;
  1294.                 if (rnum == IT_AXE)
  1295.                 {
  1296.                     deathstring = " was ax-murdered by ";
  1297.                     deathstring2 = "\n";
  1298.                 }
  1299.                 if (rnum == IT_SHOTGUN)
  1300.                 {
  1301.                     deathstring = " chewed on ";
  1302.                     deathstring2 = "'s boomstick\n";
  1303.                 }
  1304.                 if (rnum == IT_SUPER_SHOTGUN)
  1305.                 {
  1306.                     deathstring = " ate 2 loads of ";
  1307.                     deathstring2 = "'s buckshot\n";
  1308.                 }
  1309.                 if (rnum == IT_NAILGUN)
  1310.                 {
  1311.                     deathstring = " was nailed by ";
  1312.                     deathstring2 = "\n";
  1313.                 }
  1314.                 if (rnum == IT_SUPER_NAILGUN)
  1315.                 {
  1316.                     deathstring = " was punctured by ";
  1317.                     deathstring2 = "\n";
  1318.                 }
  1319.                 if (rnum == IT_GRENADE_LAUNCHER)
  1320.                 {
  1321.                     deathstring = " eats ";
  1322.                     deathstring2 = "'s pineapple\n";
  1323.                     if (targ.health < -40)
  1324.                     {
  1325.                         deathstring = " was gibbed by ";
  1326.                         deathstring2 = "'s grenade\n";
  1327.                     }
  1328.                 }
  1329.                 if (rnum == IT_ROCKET_LAUNCHER)
  1330.                 {
  1331.                     deathstring = " rides ";
  1332.                     deathstring2 = "'s rocket\n";
  1333.                     if (targ.health < -40)
  1334.                     {
  1335.                         deathstring = " was gibbed by ";
  1336.                         deathstring2 = "'s rocket\n" ;
  1337.                     }
  1338.                 }
  1339.                 if (rnum == IT_LIGHTNING)
  1340.                 {
  1341.                     deathstring = " accepts ";
  1342.                     if (attacker.waterlevel > 1)
  1343.                         deathstring2 = "'s discharge\n";
  1344.                     else
  1345.                         deathstring2 = "'s shaft\n";
  1346.                 }
  1347.                 bprint (targ.netname);
  1348.                 bprint (deathstring);
  1349.                 bprint (attacker.netname);
  1350.                 bprint (deathstring2);
  1351.             }
  1352.             return;
  1353.         }
  1354.         else
  1355.         {
  1356.             targ.frags = targ.frags - 1;
  1357.             bprint (targ.netname);
  1358.  
  1359.             // killed by a montser?
  1360.             if (attacker.flags & FL_MONSTER)
  1361.             {
  1362.                 if (attacker.classname == "monster_army")
  1363.                     bprint (" was shot by a Grunt\n");
  1364.                 if (attacker.classname == "monster_demon1")
  1365.                     bprint (" was eviscerated by a Fiend\n");
  1366.                 if (attacker.classname == "monster_dog")
  1367.                     bprint (" was mauled by a Rottweiler\n");
  1368.                 if (attacker.classname == "monster_dragon")
  1369.                     bprint (" was fried by a Dragon\n");
  1370.                 if (attacker.classname == "monster_enforcer")
  1371.                     bprint (" was blasted by an Enforcer\n");
  1372.                 if (attacker.classname == "monster_fish")
  1373.                     bprint (" was fed to the Rotfish\n");
  1374.                 if (attacker.classname == "monster_hell_knight")
  1375.                     bprint (" was slain by a Death Knight\n");
  1376.                 if (attacker.classname == "monster_knight")
  1377.                     bprint (" was slashed by a Knight\n");
  1378.                 if (attacker.classname == "monster_ogre")
  1379.                     bprint (" was destroyed by an Ogre\n");
  1380.                 if (attacker.classname == "monster_oldone")
  1381.                     bprint (" became one with Shub-Niggurath\n");
  1382.                 if (attacker.classname == "monster_shalrath")
  1383.                     bprint (" was exploded by a Vore\n");
  1384.                 if (attacker.classname == "monster_shambler")
  1385.                     bprint (" was smashed by a Shambler\n");
  1386.                 if (attacker.classname == "monster_tarbaby")
  1387.                     bprint (" was slimed by a Spawn\n");
  1388.                 if (attacker.classname == "monster_vomit")
  1389.                     bprint (" was vomited on by a Vomitus\n");
  1390.                 if (attacker.classname == "monster_wizard")
  1391.                     bprint (" was scragged by a Scrag\n");
  1392.                 if (attacker.classname == "monster_zombie")
  1393.                     bprint (" joins the Zombies\n");
  1394.  
  1395.                 return;
  1396.             }
  1397.  
  1398.             // tricks and traps
  1399.             if (attacker.classname == "explo_box")
  1400.             {
  1401.                 bprint (" blew up\n");
  1402.                 return;
  1403.             }
  1404.             if (attacker.solid == SOLID_BSP && attacker != world)
  1405.             {    
  1406.                 bprint (" was squished\n");
  1407.                 return;
  1408.             }
  1409.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1410.             {
  1411.                 bprint (" was spiked\n");
  1412.                 return;
  1413.             }
  1414.             if (attacker.classname == "fireball")
  1415.             {
  1416.                 bprint (" ate a lavaball\n");
  1417.                 return;
  1418.             }
  1419.             if (attacker.classname == "trigger_changelevel")
  1420.             {
  1421.                 bprint (" tried to leave\n");
  1422.                 return;
  1423.             }
  1424.  
  1425.             // in-water deaths
  1426.             rnum = targ.watertype;
  1427.             if (rnum == -3)
  1428.             {
  1429.                 if (random() < 0.5)
  1430.                     bprint (" sleeps with the fishes\n");
  1431.                 else
  1432.                     bprint (" sucks it down\n");
  1433.                 return;
  1434.             }
  1435.             else if (rnum == -4)
  1436.             {
  1437.                 if (random() < 0.5)
  1438.                     bprint (" gulped a load of slime\n");
  1439.                 else
  1440.                     bprint (" can't exist on slime alone\n");
  1441.                 return;
  1442.             }
  1443.             else if (rnum == -5)
  1444.             {
  1445.                 if (targ.health < -15)
  1446.                 {
  1447.                     bprint (" burst into flames\n");
  1448.                     return;
  1449.                 }
  1450.                 if (random() < 0.5)
  1451.                     bprint (" turned into hot slag\n");
  1452.                 else
  1453.                     bprint (" visits the Volcano God\n");
  1454.                 return;
  1455.             }
  1456.  
  1457.             // fell to their death?
  1458.             if (targ.deathtype == "falling")
  1459.             {
  1460.                 targ.deathtype = "";
  1461.                 bprint (" fell to his death\n");
  1462.                 return;
  1463.             }
  1464.  
  1465.             // hell if I know; he's just dead!!!
  1466.             bprint (" died\n");
  1467.         }
  1468.     }
  1469. };
  1470.